﻿using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using System.Threading;
using System.Threading.Tasks;

namespace WebApiDemo.Services
{
    public class Worker : IHostedService
    {
        private readonly ILogger _logger;

        public Worker( ILogger<Worker> logger)
        {
            this._logger = logger;
        }
        public Task StartAsync(CancellationToken cancellationToken)
        {
            _logger.LogInformation("start work");
            return Task.CompletedTask;
        }

        public Task StopAsync(CancellationToken cancellationToken)
        {
            _logger.LogInformation("stop work");
            return Task.CompletedTask;
        }
    }
}
